home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2005 October / PCWOCT05.iso / Software / FromTheMag / The GIMP 2.2.8 / gimp-2.2.8-i586-setup.exe / {app} / share / gimp / 2.0 / scripts / spinning-globe.scm < prev    next >
Encoding:
GIMP Script-Fu Script  |  2005-06-30  |  3.5 KB  |  124 lines

  1. ;
  2. ; anim_sphere
  3. ;
  4. ;
  5. ; Chris Gutteridge (cjg@ecs.soton.ac.uk)
  6. ; At ECS Dept, University of Southampton, England.
  7. ; This program is free software; you can redistribute it and/or modify
  8. ; it under the terms of the GNU General Public License as published by
  9. ; the Free Software Foundation; either version 2 of the License, or
  10. ; (at your option) any later version.
  11. ; This program is distributed in the hope that it will be useful,
  12. ; but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  14. ; GNU General Public License for more details.
  15. ; You should have received a copy of the GNU General Public License
  16. ; along with this program; if not, write to the Free Software
  17. ; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  18.  
  19.  
  20. ; Define the function:
  21.  
  22. (define (script-fu-spinning-globe inImage 
  23.                   inLayer 
  24.                   inFrames 
  25.                   inFromLeft 
  26.                   inTransparent 
  27.                   inIndex 
  28.                   inCopy)
  29.   (let* (
  30.         (theImage (if (= inCopy TRUE)
  31.                     (car (gimp-image-duplicate inImage))
  32.                     inImage))
  33.         (theLayer (car (gimp-image-get-active-layer theImage)))
  34.         (n 0)
  35.         (ang (* (/ 360 inFrames) 
  36.             (if (= inFromLeft TRUE) 1 -1) ))
  37.         (theFrame)
  38.         )
  39.  
  40.   (gimp-layer-add-alpha theLayer)
  41.   
  42.   (while (> inFrames n)
  43.      (set! n (+ n 1))
  44.      (set! theFrame (car (gimp-layer-copy theLayer FALSE)))
  45.      (gimp-image-add-layer theImage theFrame 0)
  46.      (gimp-drawable-set-name theFrame 
  47.                   (string-append "Anim Frame: " 
  48.                          (number->string (- inFrames n) 10)
  49.                          " (replace)"))
  50.      (plug-in-map-object RUN-NONINTERACTIVE
  51.                  theImage theFrame 
  52.                             ; mapping
  53.                  1
  54.                     ; viewpoint
  55.                  0.5 0.5 2.0
  56.                     ; object pos 
  57.                  0.5 0.5 0.0
  58.                     ; first axis
  59.                  1.0 0.0 0.0
  60.                     ; 2nd axis
  61.                  0.0 1.0 0.0
  62.                     ; axis rotation
  63.                  0.0 (* n ang) 0.0
  64.                     ; light (type, color)
  65.                  0 '(255 255 255)
  66.                     ; light position
  67.                  -0.5 -0.5 2.0
  68.                     ; light direction
  69.                  -1.0 -1.0 1.0
  70.                     ; material (amb, diff, refl, spec, high)
  71.                  0.3 1.0 0.5 0.0 27.0
  72.                            ; antialias 
  73.                  TRUE 
  74.                            ; tile
  75.                  FALSE
  76.                            ; new image 
  77.                  FALSE 
  78.                            ; transparency
  79.                  inTransparent 
  80.                            ; radius
  81.                  0.25
  82.                            ; unused parameters
  83.                  1.0 1.0 1.0 1.0
  84.                  -1 -1 -1 -1 -1 -1 -1 -1)
  85.      ; end while: 
  86.      )
  87.   (gimp-image-remove-layer theImage theLayer)
  88.   (plug-in-autocrop RUN-NONINTERACTIVE theImage theFrame)
  89.   
  90.   (if (= inIndex 0)
  91.       ()
  92.       (gimp-image-convert-indexed theImage FS-DITHER MAKE-PALETTE inIndex
  93.                   FALSE FALSE ""))
  94.  
  95.   (if (= inCopy TRUE)
  96.       (begin  
  97.     (gimp-image-clean-all theImage)
  98.     (gimp-display-new theImage))
  99.       ())
  100.  
  101.   (gimp-displays-flush)
  102.   )
  103. )
  104.  
  105. (script-fu-register "script-fu-spinning-globe"
  106.             _"_Spinning Globe..."
  107.             "Maps the image on an animated spinning globe"
  108.             "Chris Gutteridge"
  109.             "1998, Chris Gutteridge / ECS dept, University of Southampton, England."
  110.             "16th April 1998"
  111.             "RGB* GRAY*"
  112.             SF-IMAGE       "The Image"               0
  113.             SF-DRAWABLE    "The Layer"               0
  114.             SF-ADJUSTMENT _"Frames"                  '(10 1 360 1 10 0 1)
  115.             SF-TOGGLE     _"Turn from left to right" FALSE
  116.             SF-TOGGLE     _"Transparent background"  TRUE
  117.             SF-ADJUSTMENT _"Index to n colors (0 = remain RGB)" '(63 0 256 1 10 0 1)
  118.             SF-TOGGLE     _"Work on copy"            TRUE)
  119.  
  120. (script-fu-menu-register "script-fu-spinning-globe"
  121.              _"<Image>/Script-Fu/Animators")
  122.